﻿namespace EasyWeb.Test
{
    using System.Data.Entity;
    using System.Linq;
    using System.Threading.Tasks;
    using Microsoft.VisualStudio.TestTools.UnitTesting;

    [TestClass]
    public class EWCultureDao_Test : LibraryTest
    {
        [TestMethod]
        public async Task Select_Test()
        {
            var expecteds = await this.TestDbContext.ew_tbl_cultures.ToArrayAsync();
            var actuals = await this.CultureDao.SelectAsync();

            Assert.IsNotNull(actuals);
            Assert.AreEqual(expecteds.Length, actuals.Count());
            foreach (var expected in expecteds)
            {
                var actual = actuals.Single(a => a.Id == expected.ew_uid_culture_id);
                Assert.AreEqual(expected.ew_vc_name, actual.Culture.Name);
                Assert.AreEqual(expected.ew_i_lcid, actual.Culture.LCID);
                Assert.AreEqual(expected.ew_b_enabled, actual.Enabled);
            }
        }
    }
}
